<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户信息录入</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="css/font_eolqem241z66flxr.css" media="all" />

</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote" style="border-left: 5px solid #ffffff">
    <fieldset class="layui-elem-field">
        <legend>用户信息修改</legend>
        <div class="layui-field-box">

            <a href="role">
                <button class="layui-btn" style="background-color: #1E9FFF">返回上一级</button>
            </a>

        </div>
    </fieldset>
</blockquote>
<form class="layui-form">

    <div class="layui-form-item">
        <label class="layui-form-label">用户ID</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input userId" lay-verify="required" name="userId" placeholder="请输入用户ID" value="${user.userId }">
        </div>

        <label class="layui-form-label">用户名</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input userName" lay-verify="required" name="userName" placeholder="请输入用户名" value="${user.userName }">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input pwd" lay-verify="required" name="password" placeholder="请输入密码" value="${user.password }">
        </div>
        <!--<label class="layui-form-label">确认密码</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input repwd" lay-verify="required" placeholder="请再次输入密码">
        </div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户权限</label>
        <div class="layui-input-block">
            <select name="role" class="role" lay-verify="required" >
                <option value="">请选择</option>
                <option value="1">管理员</option>
                <option value="2">网站信息发布员</option>
                <option value="3">普通用户</option>
            </select>
        </div>

    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入备注信息" name="other" class="layui-textarea other" >
            	${user.other }
            </textarea>
        </div>

    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addRole">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="layui/layui.all.js"></script>
<script src="layui/layui.js"></script>
<script>
layui.use(['form','layer','jquery','layedit','laydate'], function(){
	  var form = layui.form,
	    layer = parent.layer === undefined ? layui.layer : parent.layer,
	    laypage = layui.laypage,
	    layedit = layui.layedit,
	    laydate = layui.laydate,
	    $ = layui.jquery;
	  	var userId = $(".userId").val();
  	  	$.get("roleSurveryRevise2?userId="+userId,function(data){
  	  		$(".role").val(data.role_id);
		  	form.render('select');
  	  	});
  		//监听提交
        form.on('submit(addRole)', function(data) {
      	  debugger;
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            $.ajax({
            	contentType:'application/x-www-form-urlencoded; charset=UTF-8',
            	url : "role/reviseRole",
            	type : "post",
            	data : data.field,
            	dataType : "json"
            })
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            setTimeout(function(){
                top.layer.close(index);
                top.layer.msg("信息修改成功！");
                layer.closeAll("iframe");
                //刷新父页面
                parent.location.reload();
            },2000);
            return false;
        })
  	  
  	});
</script>
</body>
</html>